<template>
<div class='credible-wrap'>
  <div class='swiper-main' >
    <swiper
       class='swiper'
      :modules='modules'
       :loop="true"
       :centeredSlides="true"
       :slides-per-view="3"
       :space-between="0"
      :autoplay='false'
       :navigation="navigation"
        :pagination='{ clickable: true }'
       :scrollbar="{ draggable: true }"
       @swiper="onSwiper"
       @slideChange="onSlideChange"
    >
<!--    :breakpoints="{'374': {slidesPerView: 1,spaceBetween: 20},'640': {slidesPerView: 1,spaceBetween: 20},'768': {slidesPerView: 2,spaceBetween: 30},'1024': {slidesPerView: 4,spaceBetween: 40}-->
      <swiper-slide class='swiper-slide' v-for='(item, index) in credibleList' :key='index'>
        <div class='list'>
          <img :src='item.icon' :alt='item.title' class='icon'>
          <span class='title'>{{item.title}}</span>
          <p class='detail'>{{item.detail}}</p>
        </div>
      </swiper-slide>
      <div class="swiper-button-prev" @click.stop="prevEl(item, index)"></div>
      <!--左箭头。如果放置在swiper外面，需要自定义样式。-->
      <div class="swiper-button-next" @click.stop="nextEl"></div>
      <!--右箭头。如果放置在swiper外面，需要自定义样式。-->
    </swiper>

  </div>
  <div class='download_app'>
    <i class='iphone_img'></i>
    <p class='con'><span >下载<em class='tit'>睐回</em>APP</span><i class='close_icon'></i></p>
  </div>
  <div class='normal-con' v-if='false'>
    <ul>
      <li class='list' v-for='(item,index) in credibleList'>
        <img :src='item.icon' :alt='item.title' class='icon'>
        <span class='title'>{{item.title}}</span>
        <p class='detail'>{{item.detail}}</p>
      </li>
    </ul>
  </div>
</div>
</template>

<script setup>
import {defineProps, ref, onMounted} from "vue";
import {Swiper, SwiperSlide} from 'swiper/vue'; // swiper所需光伏组件
// 这是分页器和对应方法，swiper好像在6的时候就已经分离了分页器和一些其他工具
import {Autoplay, Navigation, Pagination, A11y,EffectCoverflow} from 'swiper';
// 引入swiper样式，对应css 如果使用less或者css只需要把scss改为对应的即可
import 'swiper/css';
import 'swiper/css/navigation';
import 'swiper/css/pagination';
import 'swiper/css/effect-coverflow'
//默认滑动效果（这里面注释掉的可以不要）

const countdownRef = ref(null);
const onSwiper = (swiper) => {
  console.log(swiper);
};
const navigation = ref({
  nextEl: ".swiper-button-next",
  prevEl: ".swiper-button-prev",
});
const prevEl = (item, index) => {
  // console.log('上一张' + index + item)
};
const nextEl = () => {
  // console.log('下一张')
};
// 更改当前活动swiper
const onSlideChange = (swiper) => {
  // swiper是当前轮播的对象，里面可以获取到当前swiper的所有信息，当前索引是activeIndex
  console.log(swiper.activeIndex);
};

/*@swiper="onSwiper"*/
// const onSwiper = (swiperInstance) => {
//   resetCountdownPosition(swiperInstance);
//   swiperInstance.on('slideChange', () => {
//     console.log("切换图片了")
//     resetCountdownPosition(swiperInstance);
//   });
// };

// const resetCountdownPosition = (swiperInstance) => {
//   console.log("当前元素", countdownRef.value.style.transform)
//   countdownRef.value.style.transform = 'translateX(-0%)';
//   /*  countdownRef.value.style.width = '50%'*/
// };
// const onSlideChange = e => {
//   // swiper切换的时候执行的方法
//   console.log('slide change', e.activeIndex);
// };

const modules = [Autoplay, Pagination, Navigation, A11y,EffectCoverflow];


// eslint-disable-next-line vue/no-setup-props-destructure
// const props = defineProps({
//   picList: {
//     type: Array,
//     required: true,
//     default: () => []
//   }
// });


onMounted(() => {

});
  const credibleList =[
    {
      icon:'../../../public/img/icon1.png',
      title:'资金安全',
      detail:'人民银行第三方监管平台账户资金严格按规则进出，在货物流转未完成的情况下任何一方包括平台都不得私下挪用货款，资金100%安全。'
    },
    {
      icon:'../../../public/img/icon2.png',
      title:'生意好做',
      detail:'背靠云商会合作，顾客多一点云商会已经与超过16000家商协会和409万家会员企业建立合作关系。'
    },
    {
      icon:'../../../public/img/icon3.png',
      title:'交易保障',
      detail:'完备体系公正维护各方权益11年二奢积累的完备保障制度，300+团队护航7x24在线客服支持。'
    },
    {
      icon:'../../../public/img/icon4.png',
      title:'不压货款',
      detail:'不压保证金.资金回笼不用愁我们深知回笼资金的重要性压货款猛于虎我们为商家提供极速打款服务，保证金也随时可退24小时极速到账。'
    },
    // {
    //   icon:'../../../public/img/icon4.png',
    //   title:'不压货款',
    //   detail:'不压保证金.资金回笼不用愁我们深知回笼资金的重要性压货款猛于虎我们为商家提供极速打款服务，保证金也随时可退24小时极速到账。'
    // }
  ]
</script>

<style scoped lang='scss'>

.credible-wrap {
  width: 79%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  position: relative;
  .swiper-cons{
    width: 100%;
  }
  .normal-con{
  }
  .mySwipers{
    width: 100%;
    height: 100%;
    overflow: inherit;
    //::v-deep .swiper-wrapper{
    //  width: 100%;
    //  height: 100%;
    //}
    .swiper-items{
        width: 100%;
        height: 100%;
      .list{
        //height: 324px;
        //width: 100%;
        min-width: 285px;
        border: 1px solid #000000;
        display: flex;
          flex-direction: column;
          align-items: center;
          background: #FFFFFF;
          border: 1px solid #000000;
          margin-right: 20px;
          justify-content: center;
        overflow: hidden;
          span.title {
            font-family: PingFangSC, PingFang SC;
            font-weight: 600;
            font-size: 24px;
            color: #000000;
            line-height: 33px;
            text-shadow: 0px 2px 30px rgba(0, 0, 0, 0.1);
            text-align: left;
            font-style: normal;
            padding-top: 19px;
            padding-bottom: 26px;
          }
          p.detail {
            font-family: PingFangSC, PingFang SC;
            font-weight: 400;
            font-size: 12px;
            color: #919191;
            line-height: 20px;
            text-shadow: 0px 2px 30px rgba(0, 0, 0, 0.1);
            text-align: center;
            font-style: normal;
            padding-left: 32px;
            padding-right: 33px;
          }
      }
        img.icon{
          width: 40px;
          height: 40px;
        }
    }

  }
}

//@media screen  and (max-width: 767px) {
//  .swiper-item {
//    height: 100%;
//  }
//
//  .swiper-item > img {
//    height: 100%;
//  }
//
//}
</style>
<style lang="scss" scoped>

//
::v-deep .swiper-pagination-horizontal.swiper-pagination-bullets .swiper-pagination-bullet {
  border-radius: inherit;
  width: 100%;
  height: 2px;
  margin: 0px !important;
  position: relative;
  &::after{
    content: "";
    width: 2px;
    height: 9px;
    display: block;
    position: absolute;
    right: 0;
    background-color: #fff;
    top: -3px;

  }
  &:last-child:after{
    display: none;
  }
}
::v-deep .swiper-pagination .swiper-pagination-bullet.swiper-pagination-bullet-active {
  background-color: rgb(255, 29, 29) !important;
}
::v-deep .swiper-pagination {
  position: absolute;
  text-align: center;
  transition: 0.3s opacity;
  z-index: 10;
  width: 76.76%;
  display: flex;
  left: 50%;
  transform: translate(-50%, 50%);
  bottom: 170px;
}
::v-deep .swiper-button-prev {
  position: absolute;
  left: 77%;
  top: 86%;
  opacity: 1;
  &::after{
    width: 26px !important;
    height: 26px !important;
    font-size: 26px;
  }
  &:hover{
    opacity: 1;
    color: rgba(255, 29, 29, 1);
  }
}

::v-deep .swiper-button-next {
  position: absolute;
  left: 80%;
  top: 86%;
  opacity: 1;
  &::after{
    width: 26px !important;
    height: 26px !important;
    font-size: 26px;
  }
  &:hover{
    opacity: 1;
    color: rgba(255, 29, 29, 1);
  }
}

.download_app{

  display: none;
  p.con{
    font-family: PingFangSC, PingFang SC;
    font-weight: 300;
    font-size: 21px;
    color: #000000;
    line-height: 30px;
    text-shadow: 0px 9px 23px rgba(142, 142, 142, 0.4);
    text-align: left;
    font-style: normal;
    display: flex;
    align-items: center;
    width: 100%;
    justify-content: center;
    position: relative;
    em.tit{
      color: rgba(0, 0, 0, 1);
      font-weight: 600;
    }
  }
  i{
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    display: block;
  }
  i.iphone_img{
    width: 31px;
    height: 31px;
    background-image: url("../../../public/icon/iphone_img.png");
    margin-left: 21.5px;
  }
  i.close_icon{
    width: 12px;
    height: 12px;
    background-image: url("../../../public/icon/close_icon.png");
    //margin-right: 15px;
    //margin-left: 38.5px;
    position: absolute;
    right: 15px;
  }
}
</style>
<style scoped lang='scss'>
.swiper-main {
  position: relative;
  width: 100%;
  height: 100%;
  margin: 0 auto;
}
.swiper {
  width: 100%;
  height: 100%;
  background-color: antiquewhite;
  .swiper-slide {
    display: flex;
    justify-content: center;
    align-items: center;
    transition: 300ms;
    transform: scale(0.8);

    .swiper-img {
      width: 200px;
      height: 322px;
      border-radius: 10px;
    }
  }
  .swiper-slide-active,
  .swiper-slide-duplicate-active {
    transform: scale(1);
  }
  .swiper-button-next,
  .swiper-button-prev {
    --swiper-theme-color: red;
    --swiper-navigation-size: 20px;
  }
  //   改变小圆点的样式
  .swiper-pagination-bullet-active {
    background: white;
  }
}
</style>
